#include "Context.h"
#include "ConcreteStrategyA.h"
#include "ConcreteStrategyB.h"
/**
 * The client code picks a concrete strategy and passes it to the context. The
 * client should be aware of the differences between strategies in order to make
 * the right choice.
 * 客户端代码是创建一个具体的对象，通过指针传递给context，通过Context调用接口组织逻辑
 * 客户应该清醒的知道不同策略之间的正确顺序
 */

void ClientCode()
{
    Context* context = new Context(new ConcreteStrategyA);
    std::cout << "Client: Strategy is set to normal sorting.\n";
    context->DoSomeBusinessLogic();
    std::cout << "\n";
    std::cout << "Client: Strategy is set to reverse sorting.\n";
    context->set_strategy(new ConcreteStrategyB);
    context->DoSomeBusinessLogic();
    delete context;
}

int main()
{
    ClientCode();
    return 0;
}